Repository navigation
feat(linearscale): rating sub type with stars, hearts or thumbs - #3978
Open
AndyScherzinger wants to merge 16 commits into
Open
AndyScherzinger wants to merge 16 commits into
AndyScherzinger wants to merge 16 commits into
Conversation
1 task done
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
2 times, most recently
from
November 21, 2026 16:14
ff62836 to
3c51064
Compare
AndyScherzinger
changed the base branch from
main
to
fix/scale-answer-plain-number
November 21, 2026 16:14
This was referenced Nov 21, 2026
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 21, 2026 17:28
3c51064 to
4759247
Compare
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
force-pushed
the
fix/scale-answer-plain-number
branch
from
November 21, 2026 19:44
fa31015 to
eb66419
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 21, 2026 19:44
4759247 to
9c7011a
Compare
Chartman123
reviewed
Nov 21, 2026
Chartman123
left a comment
Collaborator
There was a problem hiding this comment.
Just one question about the presentation in the NcActions menu
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 21, 2026 21:25
9c7011a to
d65bdbd
Compare
AndyScherzinger
force-pushed
the
fix/scale-answer-plain-number
branch
from
November 21, 2026 21:25
eb66419 to
3b2e625
Compare
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 21, 2026
AndyScherzinger
commented
Nov 22, 2026
AndyScherzinger
commented
Nov 22, 2026
AndyScherzinger
commented
Nov 22, 2026
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
3 times, most recently
from
November 22, 2026 11:38
0c8b48d to
1f5ffcf
Compare
A grid question accepted any string as its cell type (extraSettings.questionType). Created through the API with another value, the grid showed no cells, every answer to it was rejected as an invalid grid type, and the sub type lock kept the cell type from being corrected. Creating a question now runs its sub type through the extra settings check, and that check accepts only the cell types listed in Constants::EXTRA_SETTINGS_GRID_QUESTION_TYPE, which nothing used so far. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The API documents that an extraSettings value adding, removing or changing the sub type of a question is rejected with 403 Forbidden. The extra settings were validated first, though, so such a request got 400 Bad Request whenever the new settings were invalid as well, for example a grid cell type that is not known. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 22, 2026 14:53
1f5ffcf to
9f9f060
Compare
A rating ("how would you rate this") is answered with one whole number
from 1 to N, which a linear scale already stores, validates, counts in
the results and exports. It therefore becomes a sub type of the linear
scale rather than a question type of its own: fixed when the question
is created and stored in extraSettings.questionType, the way grid
questions store their cell type.
The add-question menu lists "Numbers" and "Rating" under "Linear
scale". The editor of a rating offers only the highest rating (2 to
10, default 5), since a rating always starts at 1. Answers, results
and exports go through the existing linear scale paths; the results
summary names a rating "Linear scale (Rating)".
The server accepts no other sub type of a linear scale and keeps a
rating starting at 1. Existing linear scale questions have no sub type
and stay as they are.
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Drawn as a row of radio buttons with labels, a rating is not the compact control people expect for it. A rating now draws stars, hearts or thumbs up (extraSettings.ratingIcon) instead of the radio buttons and labels, still built from real radio inputs: each is named "3 of 5", has a hit area of --default-clickable-area, the icons wrap, and the hover effect is dropped under reduced motion. The editor offers the icon next to the highest rating. The server accepts ratingIcon only on a rating and only with one of the known icons. Closes #2608 Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq> Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Brings over the changes from the original rating branch that give each icon its own color and size: stars are drawn in yellow, hearts in red and thumbs up in blue, through a color per icon and the --rating-color property of the rating, and the icons are drawn at 34 px with a gap of four grid baselines between them. Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de> Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
…heck The check that allows a rating icon only on a rating compared the sub type with a string literal, while every other sub type check uses Constants::ANSWER_LINEARSCALE_TYPE_RATING. A typo in the literal would silently switch the check off. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
A rating draws icons and never shows the labels of the lowest and the highest value, neither in the editor nor on the submit page nor in the results, yet the server accepted and stored them. Labels sent for a rating are now rejected like a rating icon on a plain scale; clearing them with null stays possible. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The icon radios in the question menu listened only to their change event, which NcActionRadio does not emit on every selection, so the menu could show two icons as selected while only one was saved. They now react to the model update NcActionRadio emits for each selection. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The radios of a rating form a native group, so screen readers already
announce the position of each option within it. Naming each option
"3 of 5" made them read the position twice ("3 of 5, radio button,
3 of 5"). Each option is now named by its value, like the options of
a plain scale.
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The hidden radio of each rating option was a 1 px sliver at the edge of its icon, so screen readers that highlight the focused element (TalkBack, Narrator, NVDA) outlined that sliver instead of the icon. The radio now covers the whole option while staying invisible. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Create the question through "Linear scale" > "Rating" and check what unit tests cannot: the accessible names of the rating and its options, restoring an answer from a draft and when editing a response, the error of a required rating and that picking a rating clears it, Enter moving on to the submit button instead of submitting the form, focus and the insert menu of a new rating, and the highest rating and the icon chosen in the editor. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
A required linear scale left empty shows "You must answer this question" and marks its radio buttons invalid. A rating cleared both as soon as a value was picked, while a plain scale kept them until the next submit attempt, so screen readers went on announcing the picked value as invalid. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
In the editor the radio buttons of a linear scale referenced the question title as their group name and the label of the lowest value as the description of the first one, but both are only rendered on the submit page, so the references pointed nowhere. On the submit page the description of the first radio button pointed nowhere as well when the label of the lowest value is empty. Both are now set only where the element exists, as for a rating. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 22, 2026 16:18
9f9f060 to
e101909
Compare
1 task done
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
3 times, most recently
from
November 22, 2026 17:53
7e3c30f to
8ecea27
Compare
A rating is read as "4.3 of 5 stars", so the results summary of a rating question shows its average rating and how many ratings it is based on, above the counts per value. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The first entry of the sub menu of "Grid" and "Linear scale" in the add-question menu leads back to all question types, but it was named only after the question type, like the entry that opened the sub menu, and it is the entry that receives focus. A screen reader user could not tell that it goes back. It is now named, for example, "Linear scale, back to all question types". Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The editor offered the icons of a rating as a caption and three radio entries in the question's actions menu, which made the menu long. A dropdown labelled "Icon" now takes their place, built like the "Highest rating" input above it, and shows the chosen icon in front of it. "Highest rating" shows the pencil of the other range inputs again, so the menu shows the chosen icon only once. The list shows the names only, as NcActionInput passes no option slot on to its select. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 22, 2026 17:56
8ecea27 to
7ac1892
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
Part 1 of 2 of the linear scale stack. Merge in this order:
Closes #2608.
Screenshots
A rating question ("how would you rate this?") drawn as stars, hearts or thumbs up, from 1 to N icons (N from 2 to 10, default 5). A linear scale already stores, validates, counts and exports exactly this kind of answer, but draws it as a row of radio buttons with labels, which is wider and not the control people expect for a rating.
Replaces #3637, based on the work of its original contributor, which added the rating as a question type of its own. The commit that draws the rating as stars, hearts or thumbs (3415233) carries their authorship and sign-off; changes made during review are separate commits on top of it. Their original contribution, before the rework into a sub type: fa597973 (rating question type) and 2465c996 (built on the linear scale's settings and validation).
Christian Hartmann contributed to the original rating branch as well: 955043fa colors the icons and checks ratings as scale answers, and 21818019 adjusts the icon size and spacing. The icon colors, the list of icon choices, the "Highest rating" label, the icon size and the spacing are part of the reworked rating; the server-side checks became unnecessary, because a rating is now a linear scale and is validated as one. The icon colors, size and spacing are in a commit authored by him (c6b65f5).
Rating as a sub type of the linear scale
Following the design discussed in #3637, the rating is not a new question type but a sub type of
linearscale, fixed when the question is created and stored inextraSettings.questionType, the way grid questions store their cell type:extraSettings.ratingIcon:star,heartorthumb), chosen from an "Icon" dropdown that shows the chosen icon.FormsQuestionType, no migration.ratingIconon anything but a rating.newQuestion'ssubtypeparameter is widened toFormsQuestionSubtype(openapi.jsonregenerated,docs/API_v3.mdanddocs/DataStructure.mdupdated).The promoter score sub type of #3984 follows the same pattern. Like every sub type, it cannot be changed after the question is created.
Fixes main needs as well
Found in review; each is a separate commit, because main has the same problem:
Constants::EXTRA_SETTINGS_GRID_QUESTION_TYPE), asdocs/API_v3.mdsays.Accessibility
The rating is built from real radio inputs: each option is named by its value, as screen readers announce its position ("3 of 5") themselves, the hidden radio lies over its icon so that screen readers highlight the icon, the hit area is a full
--default-clickable-areasquare while the icon stays at 34 px, Enter moves on to the next field (handled by the form), the focus ring shows for keyboard focus, the hover effect is dropped underprefers-reduced-motion, and the icons wrap on narrow screens. A required rating left empty shows "You must answer this question" and marks its radios invalid. In the results, the average icons are decorative (the text carries the value); filled parts use the icon's color and empty parts a grey outline, so filled and empty differ by shape as well as color, with at least 3:1 contrast between them in light and dark, also under simulated protanopia, deuteranopia and tritanopia.How to verify
Checked on a Nextcloud 36 development instance in the editor, the submit view logged in, a public link (360 px wide, reduced motion) and an embedded form (dark): axe-core reports no violations, keyboard answering and submitting works in all three, and the results summary counts the rating per value. PHPUnit (FormsService, ApiController, SubmissionService), ESLint, Stylelint, Prettier and the build pass,
vue-tscreports no new errors, and the full Playwright suite passes on the top of the stack (84 tests).🤖 AI (if applicable)